home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-04 | 2.5 KB | 93 lines | [TEXT/KAHL] |
- /********************************************************* DEFINITION
- DATE: 9/27/93
- AUTHOR: Eric R. Rosé
-
- CLASS: CPPRadioButton
-
- SUPERCLASS: CPPVisualObject
-
- This C++ class manages a radio button control
-
- ********************************************************************/
-
- #include <CPPRadioButton.h>
- #include <CPPRadioCluster.h>
-
- extern Rect kDefaultRect;
- extern Rect kEmptyRect;
-
- /*-----------------------------------------------------------------*/
- /*------------------------ PUBLIC METHODS -------------------------*/
- /*-----------------------------------------------------------------*/
-
- CPPRadioButton::CPPRadioButton (CPPWindow *itsWindow,
- CPPRadioCluster *itsCluster,
- short ResID,
- Boolean initiallyOn,
- Boolean canBeTarget,
- Boolean active, Boolean visible) :
- CPPControl (itsWindow, ResID, FALSE, canBeTarget,
- active, visible)
- /* load a control resource and initialize with the given data */
- {
- if ((this->myCluster = itsCluster) != NULL)
- this->myCluster->AppendItem (this);
-
- if (this->theControl)
- SetValue (initiallyOn);
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPRadioButton::CPPRadioButton (CPPWindow *itsWindow,
- CPPRadioCluster *itsCluster,
- Rect *itsBounds,
- StringPtr itsText, Boolean initiallyOn,
- Boolean useWindowFont,
- Boolean canBeTarget,
- Boolean active, Boolean visible) :
- CPPControl (itsWindow, itsBounds, radioButProc,
- itsText, FALSE, useWindowFont,
- canBeTarget, active, visible)
- {
- if ((this->myCluster = itsCluster) != NULL)
- this->myCluster->AppendItem (this);
-
- // if the radio button is 'on', call our method to
- // insure exclusivity within a group of radio buttons
- if (this->theControl && initiallyOn)
- DoOnClick ();
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPRadioButton::~CPPRadioButton (void)
- {
-
- }
-
- /*-----------------------------------------------------------------*/
-
- char *CPPRadioButton::ClassName (void)
- {
- return "CPPRadioButton";
- }
-
- /*-----------------------------------------------------------------*/
-
- void CPPRadioButton::DoOnClick (void)
- /* when a radio button is clicked, turn it on */
- /* SUBCLASS SHOULD OVERRIDE */
- {
- // if it is part of a cluster, have the cluster
- // set its value (so it can insure exclusivity)
- if (this->myCluster)
- this->myCluster->TurnOn(this);
- else
- SetValue (1);
-
- // let the superclass run the callback proc
- CPPControl::DoOnClick();
- }
-
-